<template>
  <div class="tab-wrapper">
    <!-- <app-header :showLeft="false" :showBorder="false"></app-header> -->
    <div class="tab-main">
    <!-- <app-switch
      v-model="testValue"
      active-color="#13ce66"
      inactive-color="#ff4949"
      active-text="开启"
      inactive-text="关闭"
      active-value="0"
      inactive-value="1"
      width="51px"
      >
    </app-switch> -->
      <!-- <mt-switch ref="switchR" :model="test" >开启</mt-switch> -->

      <div class="intro-wrapper" ref="introElem">
        <img class="banner" src="@/assets/images/common/banner.png" alt="" />
        <div class="intro">
          <h3>贷款对象：</h3>
          <p>
            ①年龄22-65周岁的具有完全民事行为能力的中国籍自然人。借款人年龄加上其贷款期限不得超过70周岁
          </p>
          <p>②信用记录良好。</p>
          <h3>贷款额度：</h3>
          <p>最高额度可达1000万！</p>
          <h3>抵押率：</h3>
          <p>抵押率最高可达85%！</p>
          <h3>期限长：</h3>
          <p>单笔贷款期限最长可达20年！</p>
          <h3>无还本续贷：</h3>
          <p>信用记录良好的客户，更可享无还本续贷服务！</p>

          <h3>接受第二顺位抵押（二押）：</h3>
          <p>房子已经抵押了/仍在按揭中，也能贷！</p>
          <h3>可接受抵押物种类多：</h3>
          <p>普通商品住宅、别墅及配套车位都可以抵押！</p>
          <h3>联系电话</h3>
          <p>华通银行客服热线：4008219666</p>
          <h3>资料清单</h3>
          <table>
            <thead>
              <tr>
                <th>编号</th>
                <th>资料名称</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>1</td>
                <td>身份证件（借款人、配偶、共同债务人、抵押人及保证人）</td>
              </tr>
              <tr>
                <td>2</td>
                <td>
                  户口本（借款人、配偶、抵押人、保证人提供了配偶名下房产时应提供）
                </td>
              </tr>
              <tr>
                <td>3</td>
                <td>
                  婚姻证明
                </td>
              </tr>
              <tr>
                <td>4</td>
                <td>
                  统一社会信用代码证等经营类证件或证明
                </td>
              </tr>
              <tr>
                <td>5</td>
                <td>
                  贷款用途材料（购销合同、采购定单、发票等之一）
                </td>
              </tr>
              <tr>
                <td>6</td>
                <td>
                  借款人/配偶资产证明（第三方抵押，还应提供抵押人的房产证明）
                </td>
              </tr>
              <tr>
                <td>7</td>
                <td>
                  抵/质押物权属证明（含共有人房产证、不动产权证）
                </td>
              </tr>
              <tr>
                <td>8</td>
                <td>
                 房地产评估报告
                </td>
              </tr>
              <tr>
                <td>9</td>
                <td>
                 借款人/配偶/财务人员/经营实体银行、微信、支付宝对账单(不少于三个月)
                </td>
              </tr>
              <tr>
                <td>10</td>
                <td>
                  其他业务相关资料
                </td>
              </tr>
            </tbody>
          </table>
        </div>
        <div class="btn-group" ref="btnGroupElem">
          <button class="btn btn-plain" @click="invite">推荐好友</button>
          <button class="btn btn-primary"  @click="apply">我要申请</button>
        </div>
      </div>
      <div class="fixed" @click="apply" ref="applyBtn" v-show="fixShow"></div>

    </div>
  </div>
</template>

<script>
import { throttle } from "@/utils";
import weChatConfig from "@/utils/weChat"

export default {
  name: "tab1",
  components: {},
  data() {
    return {
      fixShow: true,
      test: false,
      testValue:"string"
    };
  },
  created() {
    const query = this.$route.query;
    if (Object.keys(query).length > 0) {
      const { openid, token, referrer } = query;
      this.$store.dispatch("user/setOpenid", openid);
      this.$store.dispatch("user/setToken", token);
      this.$store.dispatch("app/setReferrer", referrer);

      window.localStorage.setItem("wx", JSON.stringify({ openid, token}))
    }
  },
  mounted() {
    const that = this;
    const { introElem, btnGroupElem, applyBtn } = this.$refs;
    const introElem_h = introElem.getBoundingClientRect().height,
      btnGroupElem_h = btnGroupElem.getBoundingClientRect().height;
    weChatConfig()
    introElem.onscroll = throttle(function() {
      if (
        introElem.scrollHeight - introElem.scrollTop <=
        introElem_h + btnGroupElem_h 
      ) {
        that.fixShow = false;
      } else {
        that.fixShow = true;
      }
    }, 30);
  },
  methods: {
    apply() {
      // queryOrderStatus()
      this.$router.push({ name: "apply1" });
    },
    invite() {
      this.$router.push({ name: "invite" });
    },
    
  }
};
</script>

<style lang="scss" scoped>
@import "./index.scss";
</style>
